﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Google.Contacts;
using GDesktop.Service.DTO;
using GDesktop.Service;
using GDesktop.Arquitetura;

namespace GDesktop.Contatos
{
    public partial class EditarUsuario : UserControl
    {

        #region "Propriedades"
        public ContatosService ContatosService { get; set; }
        #endregion

        public EditarUsuario()
        {
            InitializeComponent();
            ContatosService = new ContatosService(Aplicacao.NomeAplicacao, Aplicacao.Login, Aplicacao.Password);
        }

        public void Setup(string pContactID)
        {

            ContactsDTO umContato = ContatosService.GetContactDTOByID(pContactID);

            if (umContato.Contact.Name != null)
            {
                txtNome.Text = umContato.Contact.Name.GivenName;
                txtSobreNome.Text = umContato.Contact.Name.FamilyName;

            }            

            if (umContato.Photo != null)
                pctPhoto.Image = umContato.Photo;

        }
    }
}
